package indi.zhifa.study2024.class002.busy.generalTest.controller.nbr;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import indi.zhifa.study2024.class002.busy.generalTest.business.report.consign.entity.request.*;
import indi.zhifa.study2024.class002.busy.generalTest.business.report.consign.entity.response.*;
import indi.zhifa.study2024.class002.busy.generalTest.business.report.consign.service.IConsignReportService;
import indi.zhifa.study2024.core.common.web.entity.ann.ZhiFaRestController;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

@Slf4j
@Validated
@RequiredArgsConstructor
@RequestMapping(value = "/class002/nbr/report/consign")
@ZhiFaRestController
@Tag(name = "销售报表")
public class ConsignReportController {

    private final IConsignReportService mConsignReportService;

    @Operation(summary = "销售报表-以商品分组")
    @PostMapping("/groupByItem")
    public Page<ConsignGroupByItemReportResponse> pageConsignGroupByItem(@RequestBody ConsignGroupByItemReportRequest pConsignGroupByItemReportRequest){
        return mConsignReportService.pageConsignGroupByItem(pConsignGroupByItemReportRequest);
    }

    @Operation(summary = "销售报表-以品牌分组")
    @PostMapping("/groupByBrand")
    public Page<ConsignGroupByBrandReportResponse> pageConsignGroupByBrand(@RequestBody ConsignGroupByBrandReportRequest pConsignGroupByBrandReportRequest){
        return mConsignReportService.pageConsignGroupByBrand(pConsignGroupByBrandReportRequest);
    }

    @Operation(summary = "销售报表-以业务员分组")
    @PostMapping("/groupBySales")
    public Page<ConsignGroupBySalesReportResponse> pageConsignGroupBySales(@RequestBody ConsignGroupBySalesReportRequest pConsignGroupBySalesReportRequest){
        return mConsignReportService.pageConsignGroupBySales(pConsignGroupBySalesReportRequest);
    }

    @Operation(summary = "销售报表-以门店分组")
    @PostMapping("/groupByCustomer")
    public Page<ConsignGroupByCustomerReportResponse> pageConsignGroupByCustomer(@RequestBody ConsignGroupByCustomerReportRequest pConsignGroupByCustomerReportRequest){
        return mConsignReportService.pageConsignGroupByCustomer(pConsignGroupByCustomerReportRequest);
    }

    @Operation(summary = "销售报表-以门店和商品分组")
    @PostMapping("/groupByCustomerAndItem")
    public Page<ConsignGroupByCustomerAndItemReportResponse> pageConsignGroupByCustomerAndItem(@RequestBody ConsignGroupByCustomerAndItemReportRequest pConsignGroupByCustomerAndItemReportRequest){
        return mConsignReportService.pageConsignGroupByCustomerAndItem(pConsignGroupByCustomerAndItemReportRequest);
    }

}
